from typing import List

from sqlalchemy.orm import Mapped, relationship
from app.models.Student import Student
from app.extensions import Base,INT_PK,STR_NOTNULL_20
class Clas(Base):
    __tablename__ = "clases" # 表名
    id: Mapped[INT_PK] #主键id
    name: Mapped[STR_NOTNULL_20]
    StudentList: Mapped[List["Student"]] = relationship(back_populates="clas",lazy=False)
    def __repr__(self):
        return f"<Clas id:{self.id} name:{self.name}>"
if __name__ == '__main__':
    from app.extensions import engine
    Base.metadata.create_all(engine)